package com.pgeneral.user.management.controller;

import com.pgeneral.user.management.config.ResultBean;
import com.pgeneral.user.management.dto.UserSopRoleDTO;
import com.pgeneral.user.management.service.UserSoprolescopeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 角色权限关系表
 *
 * @author
 */
@Slf4j
@RestController
@RequestMapping("/user/sopRoleScope")
public class UserSopRoleScopeController {

    @Autowired
    private UserSoprolescopeService service;

    /**
     * 保存角色表数据和角色权限表数据,返回保存数量
     *
     * @param userSopRoleDTO
     * @return
     */
//    @LogAnnotation(module="/user/sopScopeData",operator = "/getInfo 保存角色表数据和角色权限表数据,返回保存数量")
    @PostMapping(value = "/saveRoleScope")
    public ResultBean saveRoleScope(@RequestBody UserSopRoleDTO userSopRoleDTO) {
        log.info("保存角色表数据和角色权限表数据,返回保存数量");
        int result = service.saveRoleScope(userSopRoleDTO);
        return ResultBean.InsertSuccessResult(result);

    }

    /**
     * 更新角色表数据和角色权限表数据
     *
     * @param userSopRoleDTO
     * @return
     */
//    @LogAnnotation(module="/user/sopScopeData",operator = "/getInfo 保存角色表数据和角色权限表数据,返回保存数量")
    @PostMapping(value = "/updateRoleScope")
    public ResultBean updateRoleScope(@RequestBody UserSopRoleDTO userSopRoleDTO) {
        log.info("保存角色表数据和角色权限表数据,返回保存数量");
        int result = service.updateRoleScope(userSopRoleDTO);
        return ResultBean.InsertSuccessResult(result);

    }
}
